package com.fizzkai.p2p.core.service.impl;

import com.fizzkai.p2p.core.domain.IpLog;
import com.fizzkai.p2p.core.mapper.IpLogMapper;
import com.fizzkai.p2p.core.query.IpLogQuery;
import com.fizzkai.p2p.core.service.IIpLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class IpLogServiceImpl implements IIpLogService {
    @Autowired
    private IpLogMapper ipLogMapper;

    @Override
    public int save(IpLog entity) {
        return ipLogMapper.insert(entity);
    }

    @Override
    public PageInfo queryPage(IpLogQuery qo) {
        PageHelper.startPage(qo.getPageNum(), qo.getPageSize());
        List<IpLog> list = ipLogMapper.queryList(qo);
        return new PageInfo(list);
    }

    @Override
    public void test() {

    }
}
